/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.alien.admin.modules.publisher.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author zengzhifang
* @date 2021-10-25
**/
@Entity
@Data
@Table(name="dp_publish_sheet_approval_record")
public class PublishSheetApprovalRecord implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "publish_sheet_flow_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "发布申请单id")
    private Long publishSheetFlowId;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "flow_node_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "节点id")
    private Integer flowNodeId;

    @Column(name = "operator_id",nullable = false)
    @NotNull
    @ApiModelProperty(value = "操作人id")
    private Long operatorId;

    /**
     * 转发给谁，
     * 这个字段是为了记录转发给谁这个参数，所以不用入库。
     */
    @Transient
    private Long forwardTo;

    @Column(name = "operator")
    @ApiModelProperty(value = "操作人姓名")
    private String operator;

    @Column(name = "handle",nullable = false)
    @NotNull
    @ApiModelProperty(value = "操作（0-提交文档 1-通过 2-驳回 3-结束流程）")
    private Integer handle;

    @Column(name = "opinions")
    @ApiModelProperty(value = "处理意见,文本")
    private String opinions;

    public void copy(PublishSheetApprovalRecord source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}